Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bnd-maven-plugin configuration merging #3490

Merged
merged 3 commits into from
Jan 2, 2025

Conversation

kwin
Copy link
Contributor

@kwin kwin commented Dec 5, 2024

Previously the configuration from the parent (per execution id) was overriding the local config (per plugin). Now the parent configuration is no longer per execution id, i.e. both local plugin configurations (i.e. on plugin level and on execution id level) take precedence.

This closes #3471

@kwin kwin requested a review from davidjgonzalez December 5, 2024 16:23
@kwin
Copy link
Contributor Author

kwin commented Dec 5, 2024

@cziegeler Can you have a look as well? Actually it doesn't seem to be a bug in bnd-maven-plugin but just a misunderstanding how the effective plugin configuration is calculated: https://issues.apache.org/jira/browse/MNGSITE-544

@davidjgonzalez davidjgonzalez added the Skip-Changelog Skips the check for a changelog entry in the CI build label Dec 5, 2024
@davidjgonzalez
Copy link
Contributor

@kwin does this address the missing onprem bundle from the all.zip as well? IIRC from last night it wasnt being added as a dep to the all's non-cloud profile.

@kwin
Copy link
Contributor Author

kwin commented Dec 5, 2024

@davidjgonzalez I just added the missing dependency in 52a5bee

@davidjgonzalez
Copy link
Contributor

It looks like the build is failing due to the onprem bundle failing aemanalyser checks:

Error:  The analyser found the following errors for author and publish : 
Error:  [artifact-rules] com.adobe.acs:acs-aem-commons-bundle-onprem:6.9.7-SNAPSHOT: The Adobe ACS Commons onprem bundle is not supported (adobe/consulting:acs-aem-commons-all:6.9.7-SNAPSHOT)

I ran into the same when I was trying to fix this in the other PR. Do we just skip running the analyzer for the non-cloud, and let the cloud build fail on any errors in the shared bundles? Im not seeing any way tell it to not analyze a specific artifact..?

@kwin kwin force-pushed the bugfix/fix-bnd-config-merging branch 2 times, most recently from b1e5fd2 to 02ce4da Compare December 6, 2024 10:18
@kwin
Copy link
Contributor Author

kwin commented Dec 6, 2024

@davidjgonzalez I now excluded running the aemanalyser on the classic/onprem package in 02ce4da. It only evaluates the one with cloud classifier.

@davidjgonzalez
Copy link
Contributor

@kwin - This is still failing, but now it thinks jacoco is being added to the bundle, tho from what i can see that's only included w/ the test scope.

Error:  Failed to execute goal com.adobe.aem:aemanalyser-maven-plugin:1.6.4:project-analyse (aem-analyser) on project acs-aem-commons-all: One or more feature analyser(s) detected feature error(s), please read the plugin log for more details -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.adobe.aem:aemanalyser-maven-plugin:1.6.4:project-analyse (aem-analyser) on project acs-aem-commons-all: One or more feature analyser(s) detected feature error(s), please read the plugin log for more details
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:375)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:299)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:963)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:296)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:199)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoFailureException: One or more feature analyser(s) detected feature error(s), please read the plugin log for more details
    at com.adobe.aem.analyser.mojos.AbstractAnalyseMojo.execute (AbstractAnalyseMojo.java:152)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:299)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:963)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:296)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:199)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Error:  
Error:  Re-run Maven using the -X switch to enable full debug logging.
Error:  
Error:  For more information about the errors and possible solutions, please read the following articles:
Error:  [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Error:  
Error:  After correcting the problems, you can resume the build with the command
Error:    mvn <args> -rf :acs-aem-commons-all
Error: Exception in thread "Thread-20" java.lang.NoClassDefFoundError: org/jacoco/agent/rt/internal_4742761/core/data/ExecutionDataWriter
	at org.jacoco.agent.rt.internal_4742761.output.FileOutput.writeExecutionData(FileOutput.java:63)
	at org.jacoco.agent.rt.internal_4742761.Agent.shutdown(Agent.java:145)
	at org.jacoco.agent.rt.internal_4742761.Agent$1.run(Agent.java:58)
Caused by: java.lang.ClassNotFoundException: org.jacoco.agent.rt.internal_4742761.core.data.ExecutionDataWriter
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:594)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:527)
	... 3 more
Error: Process completed with exit code 1.

@kwin
Copy link
Contributor Author

kwin commented Dec 14, 2024

The relevant error is

Error:  [api-regions-exportsimports] com.adobe.acs:acs-aem-commons-bundle-cloud:6.10.0-SNAPSHOT: Bundle acs-aem-commons-bundle-cloud:6.10.0-SNAPSHOT is importing package(s) org.jacoco.agent.rt.internal_4742761 in start level 20 but no bundle is exporting these for that start level. (adobe/consulting:acs-aem-commons-all:6.10.0-SNAPSHOT)

Not sure how the Jacoco agent may affect the Manifest generation and why that error was not emitted before...

@kwin
Copy link
Contributor Author

kwin commented Dec 14, 2024

Turns out the reason is offline instrumentation for jacoco (compare with https://www.eclemma.org/jacoco/trunk/doc/offline.html and https://www.eclemma.org/jacoco/trunk/doc/faq.html). It is unclear to me why Jacoco Offline instrumentation is used at all (introduced with 7cb5929, due to #1321). As powermock is no longer used, we should completely get rid of it. Jacoco seems to be leveraged for CodeCov (https://github.com/codecov/example-java) as well.

This is now tracked in #3494 and should be fixed by #3495.

kwin added 2 commits January 2, 2025 13:01
Previously the configuration from the parent (per execution id) was
overriding the local config (per plugin). Now the parent configuration
is no longer per execution id, i.e. both local plugin configurations
(i.e. on plugin level and on execution id level) take precedence.

This closes #3471
Simplify embedding
Only run aemanalyser on package with classifier "cloud"
@kwin kwin force-pushed the bugfix/fix-bnd-config-merging branch from c791475 to e37eea7 Compare January 2, 2025 12:01
Copy link

codecov bot commented Jan 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.80%. Comparing base (ef4f406) to head (733b89a).
Report is 55 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3490      +/-   ##
============================================
+ Coverage     55.54%   55.80%   +0.25%     
- Complexity     5582     5623      +41     
============================================
  Files           728      731       +3     
  Lines         29775    29897     +122     
  Branches       3884     3908      +24     
============================================
+ Hits          16540    16684     +144     
+ Misses        11684    11650      -34     
- Partials       1551     1563      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kwin kwin merged commit 5f45a0c into master Jan 2, 2025
20 checks passed
@kwin kwin deleted the bugfix/fix-bnd-config-merging branch January 2, 2025 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip-Changelog Skips the check for a changelog entry in the CI build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EmailService not working due to unsatisfied reference to MailTemplateManager in AEM on prem
2 participants